package com.easytopit.demo.spring.mvc.domain;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.hibernate.validator.constraints.Range;

// 验证的注解
public class ValidUser {
	@NotNull
	private Integer id;

	@NotBlank
	@Length(min = 3, max = 20)
	private String name;

	@Range(min = 16, max = 46, message = "请输入年龄区间在{min} ~ {max}") // 自定义显示的消息
	@NotNull
	private Integer age;

	// @NotEmpty
	// @Length(min = 4)
	@NotBlank
	private String addr;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getAddr() {
		return addr;
	}

	public void setAddr(String addr) {
		this.addr = addr;
	}

	public Integer getAge() {
		return age;
	}

	public void setAge(Integer age) {
		this.age = age;
	}

}